﻿using System;
using System.Collections.Generic;
using System.Linq;

using btmerc.API.Enums;
using btmerc.API.Schemas.Interfaces;

namespace btmerc.API.Schemas
{
    public partial class Dropships : IDropships
    {
        public Dropships(IEnumerable<Dropship> dropships) : base()
        {
            Dropship.AddRange(dropships);
        }

        public TroopCount GetTotalStorageCapacity()
        {
            return new TroopCount
            {
                AeroCapacity = (ushort)Dropship.Sum(d => d.StorageCapacity.AeroCapacity),
                BattleArmorCapacity = (ushort)Dropship.Sum(d => d.StorageCapacity.BattleArmorCapacity),
                BattlemechCapacity = (ushort)Dropship.Sum(d => d.StorageCapacity.BattlemechCapacity),
                CargoCapacity = (ushort)Dropship.Sum(d => d.StorageCapacity.CargoCapacity),
                HeavyVehicleCapacity = (ushort)Dropship.Sum(d => d.StorageCapacity.HeavyVehicleCapacity),
                TroopCapacity = (ushort)Dropship.Sum(d => d.StorageCapacity.TroopCapacity),
                VehicleCapacity = (ushort)Dropship.Sum(d => d.StorageCapacity.VehicleCapacity)
            };
        }
    }
}
